<%-- 
    Document   : SalesAnalysis
    Created on : Nov 2, 2011, 12:09:35 AM
    Author     : Mr-aUgust
--%>

<%@page pageEncoding="UTF-8"%>
<%@ page session="true" import="java.util.Collection,java.util.StringTokenizer,java.text.DecimalFormat, DAL.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <style>
            .khun
            {
             margin-left:auto;
             margin-right:auto;
             width:600px;
             margin-top:50px;
            }
            .font
            {
            font-family:"Times New Roman", Times, serif;
            font-size:x-large;
            width:500px;
            margin-left:auto;
            margin-right:auto;
            color:#0707e7;
            }
            .font111
            {
            font-family:"Times New Roman", Times, serif;
            font-size:x-large;
            font-weight:bold;
            width:200px;
            margin-left:auto;
            margin-right:auto;
            color:#0707e7;
            }
            samp
            {
             font-family:"Times New Roman", Times, serif;
             font-size:large;
             font-weight:bold;
              width:150px;
            }
        </style>
        </style>
    </head>
    <body>
         <%
           SalesAnalysisBean sabean=new SalesAnalysisBean();
                      
           String SmallSize=sabean.SelectSmallSize();
           StringTokenizer  strss=new StringTokenizer(SmallSize,"|");
           String slms=strss.nextToken();
           float moneyms=Float.parseFloat(strss.nextToken());
           
           String Fullsize=sabean.SelectFullSize();
           StringTokenizer  strfs=new StringTokenizer(Fullsize,"|");
           String slfs=strfs.nextToken();
           float moneyfs=Float.parseFloat(strfs.nextToken());
           
           String Luxury=sabean.SelectLuxurye();
           StringTokenizer  strlu=new StringTokenizer(Luxury,"|");
           String sllu=strlu.nextToken();
           float moneylu=Float.parseFloat(strlu.nextToken());
           
           String Minivan=sabean.SelectMinivan();
           StringTokenizer  str1=new StringTokenizer(Minivan,"|");
           String slmin=str1.nextToken();
           float moneymin=Float.parseFloat(str1.nextToken());
           
           int tatolRental=Integer.parseInt(slms)+Integer.parseInt(slfs)+Integer.parseInt(sllu)+Integer.parseInt(slmin);
           float tatolmoney=moneyms + moneyfs + moneylu + moneymin;
           
           DecimalFormat twoDForm = new DecimalFormat("#.##");
           float so=((Float.parseFloat(slms)*100)/tatolRental);
           float so1=(Float.parseFloat(slfs)*100)/tatolRental;
           float so2=(Float.parseFloat(sllu)*100)/tatolRental;
           float so3=(Float.parseFloat(slmin)*100)/tatolRental;
           
           float ptslms=Float.valueOf(twoDForm.format(so));
           float ptsslfs=Float.valueOf(twoDForm.format(so1));
           float ptsllu=Float.valueOf(twoDForm.format(so2));
           float ptslmin=Float.valueOf(twoDForm.format(so3));
        %>
        <div class="khun">
            <div class="font111">Sales analysis</div>
            <br>
            <br>
            <table width="600px" border="1" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td colspan="6"><div align="center" class="font">Sales analysis on the car rental service</div></td>
                </tr>
                <tr>
                    <td width="100" rowspan="7"><samp>Car type<samp></td>
                    <td><b>Car Type</b></td>
                    <td><b>Status</b></td>
                    <td><b>%</b></td>
                    <td><b>Rental</b></td>
                    <td><b>Total Money</b></td>
                </tr>
                <tr>
                    
                    <td width="80">Small Size</td>
                    <td width="156"><div style="background:#f05a08;width:<%=ptslms%>%;height:20px;"></div></td>
                    <td width="70"><%=ptslms%>%</td>
                    <td width="100"><%=slms%></td>
                    <td width="114"><f:formatNumber value="<%=moneyms%>" pattern="$#,###"/></td>
                </tr>
                <tr>
                    <td>Full Size</td>
                    <td><div style="background:#1f5308;width:<%=ptsslfs%>%;height:20px;"></div></td>
                    <td><%=ptsslfs%>%</td>
                    <td><%=slfs%></td>
                    <td><f:formatNumber value="<%=moneyfs%>" pattern="$#,###"/></td>
                </tr>
                <tr>
                    <td>Luxury</td>
                    <td><div style="background:#0853a7;width:<%=ptsllu%>%;height:20px;"></div></td>
                    <td><%=ptsllu%>%</td>
                    <td><%=sllu%></td>
                    <td><f:formatNumber value="<%=moneylu%>" pattern="$#,###"/></td>
                </tr>
                <tr>
                    <td height="23">Minivan</td>
                    <td><div style="background:#bb18ca;width:<%=ptslmin%>%;height:20px;"></div></td>
                    <td><%=ptslmin%>%</td>
                    <td><%=slmin%></td>
                    <td><f:formatNumber value="<%=moneymin%>" pattern="$#,###"/></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><b><font color="red">Total: <f:formatNumber value="<%=tatolRental%>" pattern="#,###"/></font></b></td>
                    <td><b><font color="red">100%</font></td>
                    <td><b><font color="red">Total: <f:formatNumber value="<%=tatolRental%>" pattern="#,###"/></font></b></td>
                    <td><b><font color="red">Total: <f:formatNumber value="<%=tatolmoney%>" pattern="$#,###"/></font></b></td>
                </tr>
            </table>
            
            <br><br>
            <%
            String Adultprice=sabean.SelectAdultprice();
            StringTokenizer str=new StringTokenizer(Adultprice,"|");
            String sl=str.nextToken();
            String money=str.nextToken();
            
            String Childprice=sabean.SelectChildprice();
            StringTokenizer str111=new StringTokenizer(Childprice,"|");
            String sl1=str111.nextToken();
            String money1=str111.nextToken();
            
            int tnthue=Integer.parseInt(sl)+Integer.parseInt(sl1);
            float ttthue=Float.parseFloat(money)+Float.parseFloat(money1);
            
            DecimalFormat twoDForm1 = new DecimalFormat("#.##");
            float s=((Float.parseFloat(sl)*100)/tnthue);
            float s1=((Float.parseFloat(sl1)*100)/tnthue);
            
            float ptaduil=Float.valueOf(twoDForm1.format(s));
            float ptchild=Float.valueOf(twoDForm1.format(s1));
            %>
            <table width="600px" border="1" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td colspan="6"><div align="center" class="font">Sales analysis on the Package Tour service</div></td>
                </tr>
                <tr>
                    <td width="100" rowspan="7"><samp>Price<samp></td>
                    <td><b>Price</b></td>
                    <td><b>Status</b></td>
                    <td><b>%</b></td>
                    <td><b>Book</b></td>
                    <td><b>Total Money</b></td>
                </tr>
                <tr>
                    
                    <td width="80">Adult Price</td>
                    <td width="156"><div style="background:#f05a08;width:<%=ptaduil%>%;height:20px;"></div></td>
                    <td width="70"><%=ptaduil%>%</td>
                    <td width="100"><%=sl%></td>
                    <td width="114"><f:formatNumber value="<%=money%>" pattern="$#,###"/></td>
                </tr>
                <tr>
                    <td>Child Price</td>
                    <td><div style="background:#1f5308;width:<%=ptchild%>%;height:20px;"></div></td>
                    <td><%=ptchild%>%</td>
                    <td><%=sl1%></td>
                    <td><f:formatNumber value="<%=money1%>" pattern="$#,###"/></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><b><font color="red">Total: <f:formatNumber value="<%=tnthue%>" pattern="#,###"/></font></b></td>
                    <td><b><font color="red">100%</font></td>
                    <td><b><font color="red">Total: <f:formatNumber value="<%=tnthue%>" pattern="#,###"/></font></b></td>
                    <td><b><font color="red">Total: <f:formatNumber value="<%=ttthue%>" pattern="$#,###"/></font></b></td>
                </tr>
            </table>
        </div>            
    </body>
</html>

